<?php
class MaterialPratice extends Zend_Db_Table
{
	protected $_name ="material_pratice";
	protected $_primary = 'mp_id';
	
//取得附件
   public function getpraticesBymaterial_id($material_id){
   	      $select = $this->select();
          $select->where("material_id=".$material_id);
          return $this->fetchAll($select)->toArray();
   }
   
//更新附件
  public function updatepraticesBymp_id($array,$mp_id){
  	
  		$db = $this->getAdapter();
		$where=$db->quoteInto('mp_id = ?', $mp_id);
		$this->update($array, $where);
        return true;
  }      
  //删除教材
     public function delpraticeBymaterial_id($material_id){
         $where = 'material_id = '. $material_id;
         $this->delete($where);
         return true;
    }
    
    public function delmaterialsBymp_id($mp_id){
         $where = 'mp_id = '. $mp_id;
         $this->delete($where);
         return true;    
    }
}	